#include <cstdio>

#include "fins.h"

using namespace OmronPlc;

int main()
{
	Fins fins(TransportType::Tcp);
	bool b;
	// Set Remote Node, but it is not nessecery when connect with Hostlink
	//
	fins.SetRemote("10.10.80.111");
	fins.Connect();

	short val;
	//fins.MemoryAreaRead(MemoryArea::DM, 100, 0, 1);
	//#define	SIZE 8
	//unsigned short data[SIZE] = {0};
	//b = fins.MemoryAreaRead(OmronPlc::CIO, 100, 0, SIZE, data);
	//if(b){
	//	printf("get cio data : ");
	//	for(int i=0; i<SIZE; i++){
	//		printf("%d, ",data[i]);
	//	}
	//	printf("\n");
	//}
	//fins.MemoryAreaRead(MemoryArea::DM_Bit)

	///if(fins.ReadDM(100, val)){
	///	printf("Read DM100 : %d\n",val);
	///}
	//fins.WriteDM(100, (unsigned short)100);
	unsigned char buf[32] = {0};
	buf[0] = 1;
	fins.MemoryAreaWrite(DM_Bit, 10, 2, 1, buf);
	fins.Close();

	return 0;
}

